const router = require('koa-router')()
const list = [
  {
    id: "1234567876543",
    title: '苹果手机15',
    price: 6999,
    type: 1,
    typeName: '支出'
  },
  {
    id: "876543245654",
    title: '送外卖',
    price: 200,
    type: 2,
    typeName: '收入'
  }
]
router.get('/list', ctx => {
  ctx.body = list
})

router.post('/list/add', ctx => {
  const data = ctx.request.body;
  list.push(data);
  ctx.body = {
    message: '添加成功'
  }
})
module.exports = router
